phy_speed

Returns the speed of the physics enabled instance.

语法:

phy_speed;


返回: Real(实数)


描述

This read-only variable returns the speed as a value in pixels-per-second of the physics enabled instance. Should you need to change this value, you must do so by changing the x and y vectors using the variables phy_speed_x and phy_speed_y.


例如:

if phy_speed > 10
   {
   phy_linear_damping += 0.01;
   }
else
   {
   phy_linear_damping = 2;
   }

The above code checks the speed of the physics enabled instance and then changes the linear damping based on the returned value.


上一页: Physics Variables
next: phy_com_x
© Copyright YoYo Games Ltd. 2018 All Rights Reserved